<div class="row-fluid">
    <div class="span12">

        <!-- ** widget ** -->
        <div class="well">

            <!-- ** widget header ** -->
            <div class="navbar navbar-heading">
                <div class="navbar-inner">
                    <div class="container" style="width: auto;">
                        <a class="brand" >List Resources</a>
                    </div>
                </div>
            </div>
            <!-- ** ./ widget header ** -->
            {% if resources|length > 0 %}
                        <table class="table">
				<tr>
					<th width="50">Id</th>
					<th width="100">Module</th>
					<th width="100">Controller</th>
					<th width="100">Action</th>
					<th width="50">Actions</th>
				</tr>
                                {% for resource in resources %}
				<tr>
                                    <td>{{resource.id}}</td>
                                    <td>{{resource.module}}</td>
                                    <td>{{resource.controller}}</td>
                                    <td>{{resource.action}}</td>
                                    <td><a class="btn btn-mini btn-danger" onclick="removeResource({{resource.id}})">Delete</a></td>
				</tr>
                                {% endfor %}
			</table>
            {% else %}
            No resut
            {% endif %}

        </div>
        <!-- ** ./ widget ** -->

    </div>
</div>


<script>
    function removeResource(resource)
    {
        bootbox.confirm('Do you realy want to delete this item?', function(result) {
            if (result) {
                $.ajax({
                    url: '/backend/acl/removeresource',
                    type: 'POST',
                    data: {resource_id: resource},
                    success: function (result, status){
                        if (result.message == 'success' ) {
                            location.reload();
                        } else {
                            bootbox.alert(result.message);
                        }
                    }
                });
            }
        });
    }

</script>